package shsi2rpt

import com.tsqc.system.util.table.TranposUtils

class LapGrindingProductionController {
    def dynamicQueryService

    def lapGrindingProduction() {
        def pageCurrent = params.pageCurrent ? Integer.parseInt(params.pageCurrent) : 1
        def pageSize = params.pageSize ? Integer.parseInt(params.pageSize) : 10
        params.startno = (pageSize * (pageCurrent - 1)) + 1
        params.endno = pageSize * pageCurrent
        def tableHeadList = []
        def lapGrindingProduction = []
        def pageSizeList = [10, 20, 50, 100]
        def totalCount = 0
        def list=[]

        if (params.EXPORT_CONTENT_NAME == 'Excel') {
            params.SYS_QUERY_NAME = 'lapGrindingProduction'
            lapGrindingProduction = dynamicQueryService.queryForList(params)
            list=TranposUtils.colToRow('DAY_CAN','SUM_QTY',lapGrindingProduction)
            if (list.size() > 0) {
                tableHeadList = list[0].keySet()
            }

        }
        [startno              : params.startno ?: '',
         endno                : params.endno ?: '',
         pageSize             : pageSize,
         pageSizeList         : pageSizeList,
         tableHeadList        : tableHeadList,
         lapGrindingProduction: lapGrindingProduction,
         startTime            : params.startTime ?: '',
         endTime              : params.endTime ?: '',
         partName             : params.partName ?: '',
         lotId                : params.lotId ?: '',
         list:list
        ]
    }
}